home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
batchut
/
rambat1.zip
/
RAMBATCH.TXT
< prev
Wrap
Text File
|
1992-03-22
|
7KB
|
163 lines
RAMBATCH
Version 1.0
Copyright 1992
Jay E. Morris
P.O. Box 362271
Melbourne, FL 32926
OVERVIEW
RAMBATCH is an implementation in Pascal of a concept presented in
the February 1992 issue of PCComputing.
To understand the need for RAMBATCH, one must first understand
how DOS handles disk drives. When DOS formats a disk, floppy or
hard, it divides it into sectors. Then a number of sectors are
grouped into clusters. The number of sectors in a clusters
depends upon the size of a disk. A 360K floppy will have a
cluster size of 512 bytes, a large hard drive will have a cluster
size of 2048 bytes. When DOS allocates space to a file, it does
it by cluster. So a 20 byte, 150 byte and 2000 byte file would
all actually take the same amount of disk space on a hard drive.
DOS never assigns a partial cluster.
If one uses many batch files, this problem is compounded. If
there are 30 batch files with an average size of 80 bytes, the
DIR command would show that these files use 2400 bytes. But in
reality, since each file is allocated a minimum of 2048 bytes,
61,440 bytes of disk space is used. The more batch files, the
greater the loss.
RAMBATCH solves this problems by the use of one input file that
contains all the batch files. This file is read in and each
batch file is written to a RAM disk. Using the example above,
this one file would take two clusters, or 4096 bytes, verses
61,440 for all the separate batch files.
The drawback is that you must allocate some of your RAM for the
RAM disk. Depending one your system, this may be less of a loss
than the loss of 60,000 bytes of disk space.
SETUP
Initial setup involves the creation of a RAM disk in memory. All
examples given here are in DOS 5.0. The DOS 5.0 RAM disk driver
allows one to specify the size of the disk (default 64K), the
sector size (default 512), and the number of entries (default
64). By the use of the /E switch, the disk can be created in
extended memory. The /a switch will load the drive in expanded
memory. The RAMDRIVE.SYS driver itself can also be loaded in
high memory. To determine the minimum size RAM disk, multiply the
number of batch files times the sector size. Using the example
from above, 30 files time 128 is 3840 bytes. Any file over 128
bytes would require extra sectors, one for each 128 bytes. Since
the minimum disk size is 16K, this is what we would use. The
CONFIG.SYS line would be:
DEVICEHIGH=C:\DOS\RAMDRIVE 16,128 /E
If DOS 5.0 is not used, the line is:
DEVICE=C:\DOS\RAMDRIVE 16,128
DOS will assign the next available drive letter to the drive. If
you have drives A, B, and C, the RAM disk will be D.
Next you must create the input file. The file must be named
BATCH.LIS and be on the root (top) directory of the drive RAM-
BATCH is running on. The first line of the file MUST be the RAM
drive letter. The next line is the start of the first batch
file. Each batch file starts with the key word START and the
name of the batch file. The word start MUST be in caps. Each
line of the batch file follows. Do not put in any blank lines
unless the batch file itself requires it. Following is a short
example.
d:
START PC.BAT
@echo off
c:
cd \procalc
halortp4
procalc %1 %2 %3 %4 %5
halortp4 -u > nul
cd \
START MC.BAT
@echo off
c:
cd\mc
mc -k
c:
cd\
CLS
START DB.BAT
@echo off
c:
cd\
cd\dbase
dbase
cd\
c:
cd\
cls
The word start can be used in a batch file as long as it does not
begin in column one or is in lowercase. There is no requirement
to end the file in any special way.
Finally, add a line to your AUTOEXEC.BAT file to execute RAMBATCH
upon bootup.
When your system boots, you will see a line indicating that
RAMBATCH has created the batch files and a count of the number of
batch files created. This is a double check to insure that the
batch files have been created correctly. If a START keyword is
out of place or not in upper case, the batch file will not be
created or added to the count. Thus if the count you see is not
what you think it should be, check your input file.
MISC AND DISCLAIMER
No warranty is expressed or implied. This software is provided
as is.
This is a freeware program. No remuneration is requested (but if
you feel an overwhelming urge to contribute, feel free.) If you
wish a copy of the source code, send $1 for hard copy or $3 for a
diskette (5.25") to:
Jay E. Morris
P.O. Box 362271
Melbourne, FL 32936
or if you have Internet access, contact me at:
morris@patrick-pims.af.mil
and I'll send you the code.
As a last resort, try CompuServe: 73007,3107
But I'm not there often.